import React from 'react';
import styled from 'styled-components';


const importAll = (requireContext: __WebpackModuleApi.RequireContext) => {requireContext.keys().forEach(requireContext)}
try {importAll(require.context('../icons', true, /\.svg$/));} catch(error) {console.log(error)}

const Svg = styled.svg`
  height: 24px;
  width: 24px;
`

type Props = {
    name: string
}

const Icon:React.FC<Props> = (props) => {
    return (
        <Svg className="icon">
            <use xlinkHref={'#' + props.name}/>
        </Svg>
    )
}

export default Icon